From 52d0ad25ea695da44195e49f36e69fa81b55e670 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Wed, 5 Jan 2022 21:11:03 +0000
Subject: [PATCH] [X11] Fix tag dragging in KWin

R=sky

Bug: 1279532
Change-Id: Iac166803e2149eef234045d922b630f0019c8073
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3355376
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#955869}
---
 ui/platform_window/x11/x11_topmost_window_finder.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui/platform_window/x11/x11_topmost_window_finder.cc b/ui/platform_window/x11/x11_topmost_window_finder.cc
index 50e75e17f0a..2e16393487b 100644
--- a/ui/platform_window/x11/x11_topmost_window_finder.cc
+++ b/ui/platform_window/x11/x11_topmost_window_finder.cc
@@ -68,9 +68,9 @@ bool EnumerateAllWindows(ShouldStopIteratingCallback should_stop_iterating,
 
 void EnumerateTopLevelWindows(
     ui::ShouldStopIteratingCallback should_stop_iterating) {
-  // Some WMs parent 'top-level' windows in unnamed actual top-level windows
-  // (ion WM), so extend the search depth to all children of top-level windows.
-  const int kMaxSearchDepth = 1;
+  // WMs may reparent toplevel windows inside their own containers, so extend
+  // the search to all grandchildren of all toplevel windows.
+  const int kMaxSearchDepth = 2;
   ui::EnumerateAllWindows(should_stop_iterating, kMaxSearchDepth);
 }
 
